package com.market.controller;

import com.market.service.MarKetService;
import com.market.util.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/market")
public class FruitsController {


    @Autowired
    private MarKetService marKetService;

    @PostMapping("/order/calA")
    public R Calculate_A_Price(double appleKg, double strawberryKg) {
        return R.ok(marKetService.calculateCustomerA(appleKg, strawberryKg));
    }
    @PostMapping("/order/calB")
    public R Calculate_B_Price(double appleKg, double strawberryKg, double mangoKg) {
        return R.ok(marKetService.calculateCustomerB(appleKg, strawberryKg, mangoKg));
    }
    @PostMapping("/order/calC")
    public R Calculate_C_Price(double appleKg, double strawberryKg, double mangoKg) {
        return R.ok(marKetService.calculateCustomerC(appleKg, strawberryKg,mangoKg));
    }
    @PostMapping("/order/calD")
    public R Calculate_D_Price(double appleKg, double strawberryKg, double mangoKg) {
        return R.ok(marKetService.calculateCustomerD( appleKg, strawberryKg, mangoKg));
    }

}
